require("lualib_bundle");
__TS__SourceMapTraceBack(debug.getinfo(1).short_src, {["4"] = 3,["5"] = 3,["6"] = 3,["7"] = 5,["8"] = 7,["9"] = 11,["10"] = 11,["11"] = 11,["12"] = 12,["13"] = 13,["14"] = 13,["15"] = 14,["16"] = 14,["17"] = 13,["19"] = 13,["20"] = 16,["22"] = 17,["26"] = 19,["27"] = 21,["28"] = 22,["29"] = 22,["30"] = 24,["31"] = 25,["32"] = 26,["33"] = 27,["34"] = 28,["36"] = 22,["37"] = 22,["38"] = 33,["40"] = 36,["41"] = 7});
local ____exports = {}
local ____context = require("solar.w3ts.tsx.basic_pragma.hooks.context")
local hookContext = ____context.hookContext
local hookMap = ____context.hookMap
require("solar.w3ts.tsx.basic_pragma.hooks.reconcilerHooks")
____exports.useReducer = function(reducer, initialState)
    local ____hookContext_currentIndex_0 = hookContext.currentIndex
    hookContext.currentIndex = ____hookContext_currentIndex_0 + 1
    local index = ____hookContext_currentIndex_0
    local hooks = hookMap:get(hookContext.currentInstance)
    local ____hooks_index_2 = hooks[index + 1]
    if ____hooks_index_2 == nil then
        local ____temp_1 = {type = "reducer"}
        hooks[index + 1] = ____temp_1
        ____hooks_index_2 = ____temp_1
    end
    local state = ____hooks_index_2
    if state.type ~= "reducer" then
        error(
            (("Expected a reducer hook at index " .. tostring(index)) .. ", got ") .. state.type,
            0
        )
    end
    state.reducer = reducer
    if not state.instance then
        state.value = {
            initialState,
            function(action)
                local nextValue = state.reducer(state.value[1], action)
                if state.value[1] ~= nextValue then
                    state.value = {nextValue, state.value[2]}
                    state.instance:setState({})
                end
            end
        }
        state.instance = hookContext.currentInstance
    end
    return state.value
end
return ____exports
